import type { PropsWithChildren } from "react";
import { ConfigProvider, theme, type ThemeConfig } from "antd";
import zh from "antd/locale/zh_CN";
import AntdMessageProvider from "./AntdMessageProvider";
import dayjs from "dayjs";

import "dayjs/locale/zh-cn";
import AntdModalProvider from "./AntdModalProvider";

dayjs.locale("zh-cn");

const config: ThemeConfig = {
  token: {},
  algorithm: theme.darkAlgorithm,
};

export default function AntdProvider({ children }: PropsWithChildren) {
  return (
    <ConfigProvider locale={zh} theme={config}>
      <AntdModalProvider>
        <AntdMessageProvider>{children}</AntdMessageProvider>
      </AntdModalProvider>
    </ConfigProvider>
  );
}
